<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/pages/share/taglib.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <base href="<%=basePath%>">
    <title>运城市安全生产隐患排查治理信息系统</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link href="<%=basePath%>/css/style.css" rel="stylesheet" type="text/css"/>
	<script type="text/javascript" src="<%=basePath%>/js/jquery-1.7.2.js"></script>
	<script type="text/javascript" src="<%=basePath%>/js/table_span.js"></script>
	<style type="text/css">
		#d-top {right:10px;top:50%;float:right;position:fixed;z-index:10;}
	</style>
	<script type="text/javascript">
		var numstr = /^([0-9](\.[0-9])?)*$/;//数字
		$(document).ready(function(){
			_w_table_lefttitle_rowspan('#mytable','1','3');
		});
		
		function zpFun(objId){
			var num_v=$("#number_"+objId).val();
			if((numstr.exec($.trim(num_v))==null) && ($.trim(num_v).length!=0)){
				alert('必须为数字');
				$("#number_"+objId).focus();
			}else{
				if( parseInt($("#score_"+objId).text()) < parseInt(num_v) ){
					alert('该项为不合格项，得分必须小于标准分值'+$("#score_"+objId).text()+'分');
				 	$("#number_"+objId).focus();
				 }
			}
		}
		
		function selectAll() {
			var deleteVideo = document.getElementsByName('zpHg');
			for(var i=0;i<deleteVideo.length;i++) {
			  if(!deleteVideo[i].disabled){
			    deleteVideo[i].checked=true;
			  }
			}
		}
		
		function doSelect(obj1,obj2,obj3,objId){
			if(document.getElementById(obj1).checked){
				$("#"+obj2).attr("checked",false);
				$("#"+obj3).attr("checked",false);
				var tem = $("#"+obj1).val();
				var temArry = tem.split(',');
				$("#checks_"+objId).val(temArry[1]);
				if(temArry[1]==1){//合格
					$("#number_"+objId).attr("readonly",true);
					$("#kfmsg_"+objId).attr("readonly",true);
					$("#kfmsg_"+objId).val('');
					$("#number_"+objId).val($("#score_"+objId).text());
				}else if(temArry[1]==3){
					$("#number_"+objId).val('');
					$("#number_"+objId).attr("readonly",true);
					$("#kfmsg_"+objId).attr("readonly",true);
					$("#kfmsg_"+objId).val('');
				}else{
					$("#number_"+objId).val('');
					$("#number_"+objId).attr("readonly",false);
					$("#kfmsg_"+objId).attr("readonly",false);
				}
			}
		}
		
		function funSave(m){
			var tf = false ;
			var tf1 = false ;
			var tf2 = false ;
			$(".input_link").attr('disabled',true);
			$("#isSubmit").val(m);
			if(m==0){
				document.zpForm.submit();
			}else{
				$("input[id^=checks_]").each(function(i){//数字为必填项
					if($(this).val()== '' || $(this).val() == null ){
						tf = true ;
						$("#tr_"+i).attr("style","background:#b90000");
						$("#"+i+"_1").focus() ;
						return false;
					}else if($(this).val()==2 && $("#number_"+i).val()==""){
						 if($("#number_"+i).val()==""){
						 	$("#tr_"+i).attr("style","background:#b90000");
							 $("#"+i+"_1").focus() ;
							 tf1 = true ;
							 return false;
						 }
					}else if($(this).val()==2 && $("#kfmsg_"+i).val()==""){
						 if($("#kfmsg_"+i).val()==""){
						 	$("#tr_"+i).attr("style","background:#b90000");
							 $("#"+i+"_1").focus() ;
							 tf2 = true ;
							 return false;
						 }
					}else{
						$("#tr_"+i).attr("style","");
					}
				});
				if(tf){
					$(".input_link").attr('disabled',false);
					alert('自评结果有未填写项！');
					return false;
				}else if(tf1){
					$(".input_link").attr('disabled',false);
					alert('不合格项必须填写得分！');
					return false;
				}else if(tf2){
					$(".input_link").attr('disabled',false);
					alert('不合格项必须填写扣分说明！');
					return false;
				}
				if(m==2){
				  if($("#isSuanfei").val() ==0){
				  $(".input_link").attr('disabled',false);
					alert('请先算分再进行下一步！');
					return false;
					}
				}else if(m==1){
				$("#isSuanfei").val(1);
				}
				document.zpForm.submit();
			}
		}
		function scrollit() {
			document.documentElement.scrollTop=document.body.scrollHeight- window.screen.height + 80;
		}

	</script>
  </head>
  
 <body>
<div id="allbody">
	<div class="head">
		<iframe src="<%=basePath%>/head.jsp" width="1160" height="182" scrolling="no" frameborder="0" ></iframe>
	</div>
	<div class="con">
		<div class="right" style="width: 1160px;">
			<div class="right_map" style="background:url(<%=basePath%>/images/right_map2.gif) no-repeat top left; width:1150px;">
				<div style="float: left;"><a href="<%=basePath%>/corp/index.action">首页</a> &gt; <span><a href="<%=basePath%>/fjpd/_index.action">分级评定</a></span>&gt;<span>自评打分</span></div>
				<div class="map_btn" style="margin-right:50px;">
					<input type="button" name="btntj" class="input_link" onclick="window.location.href='<%=basePath%>/fjpd/_index.action'" value="返回分级评定首页"/>
				</div>
			</div><input type="hidden" id="score" value="0"/>
			<div class="right_list" style="width: 1160px;">
				<form action="<%=basePath%>/fjpd/_zpSave.action" name="zpForm" method="post">
					<table border="0" cellpadding="0" cellspacing="0" align="center" class="infolist" style="width: 1140px;" id="mytable">
						<s:if test="%{apply!=null}">
							<tr class="cz">
								<td colspan="10" style="text-align: left;color: red">注意：在自评标准中，所有的自评项必须全部填写。</td>
							</tr>
							<tr class="cz">
								<td colspan="2" style="text-align: center;">合格项：${apply.zpHgNum }</td>
								<td colspan="2" style="text-align: center;">不合格项：${apply.zpBhgNum }</td>
								<td colspan="2" style="text-align: center;">不涉及项：${apply.zpBsjNum }</td>
								<td colspan="4" style="text-align: center;">得分：${apply.zpScore }</td>
							</tr>
							<tr class="cz">
								<th colspan="10">${apply.tabName }</th>
							</tr>
							<tr class="cz">
								<th width="8%">评定指标</th>
		     					<th width="18%" colspan="2">评定项目</th>
								<th width="25%">评定内容</th>
								<th width="5%">标准分值</th>
								<th width="15%">评分标准</th>
								<th width="10%">自评结果</th>
								<th width="5%">自评得分</th>
								<th width="14%" style="border-right:none">扣分说明</th>
							</tr>
							<s:if test="%{itemList.size>0}">
							  	<s:iterator id="obj" value="itemList" status="x">
							  		<tr class="cz" id="tr_${x.index }">
										<td>${obj.itemType1Name }</td>
										<td>${obj.itemType2Name }</td>
										<td>${obj.itemType3 }</td>
										<td style="text-align: left">${obj.itemInfo }</td>
										<td id="score_${x.index }">${obj.itemScore }</td>
										<td style="text-align: left">${obj.itemBzh }</td>
										<td>
											<s:if test="%{#obj.zpIsCheck==1}">
												<input type="checkbox" name="zpHg"   id="${x.index }_1"  value="${obj.id },1" onclick="doSelect('${x.index }_1','${x.index }_2','${x.index }_3','${x.index }');" checked="checked">合&nbsp;&nbsp;&nbsp;&nbsp;格<br>
									    		<input type="checkbox" name="zpBhg" id="${x.index }_2"  value="${obj.id },2" onclick="doSelect('${x.index }_2','${x.index }_1','${x.index }_3','${x.index }');">不合格<br>
									    		<input type="checkbox" name="zpBsj"     id="${x.index }_3"  value="${obj.id },3" onclick="doSelect('${x.index }_3','${x.index }_1','${x.index }_2','${x.index }');">不涉及
											</s:if>
											<s:elseif test="%{#obj.zpIsCheck==2}">
												<input type="checkbox" name="zpHg"   id="${x.index }_1"  value="${obj.id },1" onclick="doSelect('${x.index }_1','${x.index }_2','${x.index }_3','${x.index }');">合&nbsp;&nbsp;&nbsp;&nbsp;格<br>
									    		<input type="checkbox" name="zpBhg" id="${x.index }_2"  value="${obj.id },2" onclick="doSelect('${x.index }_2','${x.index }_1','${x.index }_3','${x.index }');" checked="checked">不合格<br>
									    		<input type="checkbox" name="zpBsj"     id="${x.index }_3"  value="${obj.id },3" onclick="doSelect('${x.index }_3','${x.index }_1','${x.index }_2','${x.index }');">不涉及
											</s:elseif>
											<s:elseif test="%{#obj.zpIsCheck==3}">
												<input type="checkbox" name="zpHg"   id="${x.index }_1"  value="${obj.id },1" onclick="doSelect('${x.index }_1','${x.index }_2','${x.index }_3','${x.index }');">合&nbsp;&nbsp;&nbsp;&nbsp;格<br>
									    		<input type="checkbox" name="zpBhg" id="${x.index }_2"  value="${obj.id },2" onclick="doSelect('${x.index }_2','${x.index }_1','${x.index }_3','${x.index }');">不合格<br>
									    		<input type="checkbox" name="zpBsj"     id="${x.index }_3"  value="${obj.id },3" onclick="doSelect('${x.index }_3','${x.index }_1','${x.index }_2','${x.index }');" checked="checked">不涉及
											</s:elseif>
											<s:else>
												<input type="checkbox" name="zpHg"   id="${x.index }_1"  value="${obj.id },1" onclick="doSelect('${x.index }_1','${x.index }_2','${x.index }_3','${x.index }');">合&nbsp;&nbsp;&nbsp;&nbsp;格<br>
									    		<input type="checkbox" name="zpBhg" id="${x.index }_2"  value="${obj.id },2" onclick="doSelect('${x.index }_2','${x.index }_1','${x.index }_3','${x.index }');">不合格<br>
									    		<input type="checkbox" name="zpBsj"     id="${x.index }_3"  value="${obj.id },3" onclick="doSelect('${x.index }_3','${x.index }_1','${x.index }_2','${x.index }');">不涉及
											</s:else>
										</td>
										<td>
											<input type="hidden" name="itemIds" id="itemId_${x.index }" value="${obj.id }">
											<input type="hidden" name="itemChecks" id="checks_${x.index}" value="${obj.zpIsCheck }">
											<s:if test="%{#obj.zpIsCheck==2}"><input type="text" name="zpScore" id="number_${x.index }" value="${obj.zpScore }" size="2" onblur="zpFun('${x.index}');"></s:if>
											<s:else><input type="text" name="zpScore" id="number_${x.index }" value="${obj.zpScore }" size="2" onblur="zpFun('${x.index}');" readonly="readonly"></s:else>
										</td>
										<td>
										<s:if test="%{#obj.zpIsCheck==2}"><textarea rows="4" cols="14" name="zpKfMsg" id="kfmsg_${x.index }">${obj.zpKfMsg }</textarea></s:if>
											<s:else><textarea rows="4" cols="14" name="zpKfMsg" id="kfmsg_${x.index }" readonly="readonly">${obj.zpKfMsg }</textarea></s:else>
										</td>
									</tr>
							  	</s:iterator>		
						  			<tr class="cz">
										<td style="text-align: center" colspan="10">
											<input type="button" id="btn1" name="btntj1" class="input_link" value="保 存" onclick="funSave('0');" title="数据暂存！"/>
											<input type="button" id="btnSubmit2" name="btntj2" class="input_link" value="算 分" onclick="funSave('1');"/>
											<input type="button" id="btnSubmit2" name="btntj2" class="input_link" value="下一步" onclick="funSave('2');"/>
											<input type="hidden" id="isSuanfei" name="isSuanfei" value="${isSuanfei }"/>
										</td>
									</tr>		  
							</s:if>
						</s:if>
						<s:else>
							<tr class="cz">
								<td>您的企业的企业类型未对应评级标准，请联系管理部门！</td>
							</tr>
						</s:else>
					</table>
					<input type="hidden" name="objId" value="${apply.id }">
					<input type="hidden" name="isSubmit" id="isSubmit" value="">
				</form>
			</div>
		</div>
	</div>
	<div id="d-top">
			<a href="#" onclick="javascript:document.body.scrollTop=0;document.documentElement.scrollTop=0;this.blur();return false;" title="回到顶部">
            <img src="<%=basePath%>/images/top.jpg" alt="回到顶部" /></a>
			<br/>&nbsp;<br/>
            <a href="#" onclick="scrollit();return false;" title="回到底部">
			<img src="<%=basePath%>/images/bottom.jpg" alt="回到底部" /></a>
	</div>
	<div class="foot">
		<iframe src="<%=basePath%>/foot.html" width="1160" height="89" scrolling="no" frameborder="0" ></iframe>
	</div>
</div>
<s:if test="%{tip!=null}">
	<script>
		alert('${tip}');
	</script>
</s:if>
</body>
</html>
